package lab02.test03;

/**
 * Created by Administrator on 2017/10/12.
 */
public class Student {
    //属性:计算机成绩、数学成绩、英语成绩
    float conputerScore=98;
    float mathScore=55;
    float englishScore=77;
    //行为:求总分、平均分、最高分、最低分，并且可以输出一个学生的完整信息。
    float sum(){
        return conputerScore+mathScore+englishScore;
    }
    float average(){
        return (conputerScore+mathScore+englishScore)/3;
    }
     float max(){
        float max=0;
        if (conputerScore>mathScore)
        {
            max=conputerScore;
            if (conputerScore>englishScore)
                max=conputerScore;
            else
            {if (englishScore>mathScore)
                max=englishScore;
        }
        }
        else max=mathScore;
        return max;
     }
    float min(){
        float min=0;
        if (conputerScore<mathScore)
        {
            min=conputerScore;
            if (conputerScore<englishScore)
                min=conputerScore;
            else
            {if (englishScore<mathScore)
                min=englishScore;
            }
        }
        else min=mathScore;
        return min;
    }
    void printStudent(){
        System.out.println("计算机成绩"+conputerScore);
        System.out.println("数学成绩"+mathScore);
        System.out.println("英语成绩"+englishScore);
    }


    //构造函数
    //main 函数
    public static void main(String[] args) {
        Student s=new Student();
        s.average();
        s.max();
        s.min();
        s.sum();
        s.printStudent();

    }
}
